<?php $this->load->view('header'); ?>
 <div id="title_background">
	<div class="wrapper"><!-- 900px wrapper -->
		<h1>Galeri Photo</h1>
		<!--<span class="title_description">This is crossroads for features. Here you could describe your page or leave it blank.</span>-->
	</div> <!-- 900px wrapper -->
</div>
</div>
<div class="cleaner"></div>
<div id="position_navi"><a href="index.html">Beranda</a> / Photo</div>
<div id="content">
<article>
<h2>Foto Anda</h2>
<a href="<?php echo base_url()."photos/add";?>"><button class="button" style="width: auto!important">Unggah Foto Baru</button></a>
<table class="style1">
	<thead>
		<tr class="first">
			<td>No</td>
			<td>Foto</td>
			<td>Judul</td>
			<td>Album</td>
			<td>Waktu Posting</td>
			<td>Status</td>
			<td></td>
		</tr>
	</thead>
	<tbody id="photo-body">
	<?php 
	$no = 1;
	if(count($photos) > 0){
		foreach($photos as $photo){ ?>
		<tr>
			<td><?php echo $no;?></td>
			<td><img src="<?php echo base_url(). PHOTO_PATH .$photo['foto'];?>" width="100"></td>
			<td><?php echo $photo['judul'];?></td>
			<td><?php echo $photo['album'];?></td>
			<td><?php echo timestamp_to_date_time($photo['waktu_posting']); ?></td>
			<td><?php echo $photo['status'];?></td>
			<td><a title="Edit" class="edit_icon" href="<?php echo base_url()."photos/edit/".$photo['id_foto'];?>">
				<a title="Delete" class="delete_icon" href="javascript:confirm_delete('<?php echo base_url()."photos/delete/".$photo['id_foto'];?>')"></td>
		</tr>
		<?php 
		$no++;
		} 
	}else{
		echo '<tr><td colspan="7">Belum ada foto yang diunggah.</td></tr>';
	}?>
	</tbody>
</table>
<div class="cleaner"></div>
<br/>
<br/>
<?php if(count($photos) > 0){ ?>
<div id="pagination"></div>
<?php } ?>
</article>
<div class="cleaner"></div>
</div>
<div class="cleaner"></div>
<?php $this->load->view('footer', $footer); ?>
<script type="text/javascript">
    $(document).ready(function () {
        $('#pagination').smartpaginator({ totalrecords: <?php echo count($photos); ?>, recordsperpage: 20, length: 5, datacontainer: 'photo-body', dataelement: 'tr', initval: 0, next: 'Next', prev: 'Prev', first: 'First', last: 'Last'});
    });
</script>